Skip to content

MAINT: Reword property docstrings to noun phrases (D421)#2097

Merged
romanlutz merged 4 commits into
microsoft:mainfrom
romanlutz:romanlutz-audit-ruff-coverage
Jun 29, 2026
Merged

MAINT: Reword property docstrings to noun phrases (D421)#2097
romanlutz merged 4 commits into
microsoft:mainfrom
romanlutz:romanlutz-audit-ruff-coverage

Conversation

@romanlutz

Copy link
Copy Markdown
Contributor

Description

PyRIT's Ruff configuration enables the pydocstyle D rules under the Google convention with preview = true, which includes D421 (property-docstring-starts-with-verb). The Google style guide recommends that an @property docstring read as a noun phrase describing the attribute (e.g. """The Bigtable path.""") rather than a function-style verb phrase (e.g. """Returns the Bigtable path."""). 118 legacy property docstrings across 80 files still started with a verb ("Return", "Returns", "Get"), so the rule was effectively unenforced against real violations.

This change rewords those 118 property docstrings to noun phrases. It is documentation-only:

  • No config change. D421 was already selected in pyproject.toml; these were pre-existing stragglers. (The separate DOC501 per-file ignore for pyrit/backend/** is an unrelated rule.)
  • No behavioral or API change. Only the exact lines flagged by Ruff were edited, so identically-worded docstrings on non-property methods were left untouched.
  • Transformations follow a consistent pattern: "Return/Returns/Get the X" becomes "The X", "Get a X" becomes "A X", and so on.

Note: D421 has no autofix, so the rewording was applied with a small file-plus-row-targeted script driven by Ruff's JSON output.

Tests and Documentation

Documentation-only change (property docstrings). Verified locally:

  • uv run ruff check passes (0 violations; previously 118 D421).
  • uv run ruff format --check clean (1313 files).
  • Unit test suites pass (4894 passed, 38 skipped across models/scenario/score/executor/datasets/setup/registry tiers).
  • Pre-commit hooks (ruff, ty, async-suffix) all pass.

biefan and others added 4 commits June 28, 2026 04:16
Reword 118 @Property docstrings across 80 files from verb-style (`Return the X`, `Get the X`) to Google-style noun phrases (`The X`) to satisfy Ruff's D421 (property-docstring-starts-with-verb) rule.

Docstring-only change with no behavior change; ruff check, ruff format --check, and the full unit test suite all pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@romanlutz romanlutz added this pull request to the merge queue Jun 29, 2026
Merged via the queue into microsoft:main with commit 46ad0b8 Jun 29, 2026
53 checks passed
@romanlutz romanlutz deleted the romanlutz-audit-ruff-coverage branch June 29, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants